package com.zxp.web.VO;

import com.zxp.web.constants.Constants;

/**
 * @author MasterZ
 * @Date 2025/9/30 17:01
 */

public class ResultUtils {
    public static ResultVO error() {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(Constants.RESPONSE_FAILURE_CODE);
        resultVO.setMsg("操作失败");
        return resultVO;
    }

    public static ResultVO error(String s) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(Constants.RESPONSE_FAILURE_CODE);
        resultVO.setMsg(s);
        return resultVO;
    }

    public static ResultVO success() {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(Constants.RESPONSE_SUCCESS_CODE);
        resultVO.setMsg("操作成功");
        return resultVO;
    }

    public static ResultVO success(String s) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(Constants.RESPONSE_SUCCESS_CODE);
        resultVO.setMsg(s);
        return resultVO;
    }

    public static ResultVO success(String s, Object data) {
        ResultVO resultVO = success(s);
        resultVO.setData(data);
        return resultVO;
    }
}
